
* Wright_AJPS09

use AJPS09replicate, clear

**Generate interactions**
gen MIL = military
replace MIL = 1 if milpers==1
gen spartyaidgl12 = sparty*aidgl12
gen MILaidgl12 = MIL*aidgl12
gen Wstar12aidgl12 = Wstar12*aidgl12
gen growthaidgl12= lag12growth*aidgl12

gen spartyaidcl12 = sparty*aidcl12
gen MILaidcl12 = MIL*aidcl12
gen Wstar12aidcl12 = Wstar12*aidcl12
gen growthaidcl12= lag12growth*aidcl12

**Duration polynomials and interactions**
gen lifetime2 = lifetime^2
gen lifetime3 = lifetime^3
gen spartylife = sparty*lifetime
gen spartylife2 = sparty*lifetime2
gen spartylife3 = sparty*lifetime3
gen MILlife = MIL*lifetime
gen MILlife2 = MIL*lifetime2
gen MILlife3 = MIL*lifetime3
gen Wstar12life = Wstar12*lifetime
gen Wstar12life2 = Wstar12*lifetime2
gen Wstar12life3 = Wstar12*lifetime3

**Decade dummies**
gen d196 = year<=1969 & year>=1960
gen d197 = year<=1979 & year>=1970
gen d198 = year<=1989 & year>=1980

**Binary democratization
gen dem = failtype==1 if failtype~=.
rename ccode ctynum

replace country = "Central African Republic" if country=="Cen African Rep"
replace country = "Dominican Republic" if country=="Dominican Rep"
replace country = "Cote D'Ivoire" if country=="Ivory Coast"
replace country = "North Korea" if country=="Korea North"
replace country = "South Korea" if country=="Korea South"
replace country = "East Germany" if country=="Germany East"
replace country = "United Arab Emirates" if country=="UAE"
replace country = "Yemen, Republic" if country=="Yemen"
replace country = "Congo, Republic" if country=="Congo Brazzaville"
replace country = "Congo, Dem. Republic" if country=="Congo Kinshasa"
replace country = "Yemen, Pdr" if country=="South Yemen"
ccode country, from(cty) to(cow) gen(ccode)
replace ccode = 364 if country=="Soviet Union"
replace ccode = 347 if country=="Serbia and Montenegro"
replace ccode = 817 if country=="South Vietnam"


 sort ccode year
merge m:1 ccode using gattlist.dta 
drop if _m==2 
drop _merge
sort ccode year
merge m:1 ccode using wtolist.dta 
drop if _m==2 
drop _merge


gen gatt = year>=gattjoin
gen wto = year>=wtojoin
gen gattwto = gatt==1 | wto==1


gen study = ""
foreach n in orig noth fe time fet ct yfe cyfe {
gen method_`n' = ""
gen dv_`n' = ""
gen b_gatt_`n' = .
gen se_gatt_`n'= .
gen pval_gatt_`n' = .
gen lo_gatt_`n'=.
gen hi_gatt_`n'=.
gen N_gatt_`n'=.
}
gen studynum= .
gen timetrend=""
qui do gatt.do

local ii = 1
***********
**Table 2**
***********

***Wstar *** 

mlogit failtype aidgl12 gattwto  Wstar12 Wstar12aidgl12 growthaidgl12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison lifetime* Wstar12life*  d19*, cluster(regtype)  

replace b_gatt_orig = _b[-1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[-1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[-1:gattwto]/_se[-1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[-1:gattwto]*invnormal(.975)) if _n==`ii' 
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

mlogit failtype aidcl12 gattwto  Wstar12 Wstar12aidcl12 growthaidcl12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison lifetime* Wstar12life*  d19*, cluster(regtype) 

replace b_gatt_orig= _b[-1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[-1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[-1:gattwto]/_se[-1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1


replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

mlogit failtype aidgl12 gattwto growthaidgl12 spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison lifetime* d19*     MILlife* spartylife*, cluster(regtype)    

replace b_gatt_orig= _b[-1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[-1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[-1:gattwto]/_se[-1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1


replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'
replace timetrend="splines+decdum" if _n==`ii'   
local ii=`ii'+1

mlogit failtype aidcl12 gattwto growthaidcl12 spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison lifetime* d19*    MILlife* spartylife*, cluster(regtype)    

replace b_gatt_orig= _b[-1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[-1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[-1:gattwto]/_se[-1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

*when decade dummies are dropped growth interaction is significant, suggesting decade collinearity is driving up the SE
mlogit failtype aidcl12 gattwto growthaidcl12 spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison lifetime*      MILlife* spartylife*, cluster(regtype)

replace b_gatt_orig= _b[-1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[-1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[-1:gattwto]/_se[-1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[-1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1

***********
**Table 3**
***********

***Random effects models***
/*xtlogit dem aidgl12  gattwto Wstar12aidgl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison lifetime*   Wstar12life*, re i(ccode) nocon
gatt `ii'
local ii=`ii'+1*/

** MODEL 1
xtlogit dem gattwto aidgl12   Wstar12aidgl12    Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison lifetime*   Wstar12life*, re i(ccode) nocon
gatt `ii' orig
xtlogit dem gattwto aidgl12   Wstar12aidgl12  Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison , re i(ccode) nocon
gatt `ii' noth
xtlogit dem gattwto aidgl12   Wstar12aidgl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison   ///
 , fe
gatt `ii' fe
xtlogit dem gattwto aidgl12   Wstar12aidgl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison ///
 lifetime*   Wstar12life*, re i(ccode) nocon
gatt `ii' time
xtlogit dem gattwto aidgl12   Wstar12aidgl12    Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison   ///
 lifetime*   Wstar12life* , fe
gatt `ii' fet
xtlogit dem gattwto aidgl12   Wstar12aidgl12    Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison ///
 i.ccode#c.year lifetime*   Wstar12life* , re i(ccode) nocon
 gatt `ii' ct
 xtreg dem gattwto aidgl12   Wstar12aidgl12    Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison i.year  ///
 , fe vce(cl ccode) 
gatt `ii' cyfe
clogit dem gattwto aidgl12   Wstar12aidgl12    Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison   ///
 , group(year) vce(cl year) 
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1

** MODEL 2
xtlogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison lifetime*   Wstar12life*, re i(ccode) nocon
gatt `ii' orig
xtlogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison , re i(ccode) nocon
gatt `ii' noth
xtlogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison   ///
 , fe
gatt `ii' fe
xtlogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison ///
 lifetime*   Wstar12life*, re i(ccode) nocon
gatt `ii' time
xtlogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison   ///
 lifetime*   Wstar12life* , fe
gatt `ii' fet
xtlogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison ///
 i.ccode#c.year lifetime*   Wstar12life* , re i(ccode) nocon
 gatt `ii' ct
 xtreg dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison i.year  ///
 , fe vce(cl ccode)
gatt `ii' cyfe
clogit dem aidcl12 gattwto  Wstar12aidcl12   Wstar12 neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison   ///
 , group(year) vce(cl year) 
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1
/*xtlogit dem aidgl12 gattwto spartyaidgl12  MILaidgl12 sparty MIL  neighbor_mean2polity conflict_intensity lgdp_maddison lag12growth_maddison lifetime*  MILlife* spartylife*, re i(ccode)
gatt `ii'
local ii=`ii'+1*/
*** MODEL 3

xtlogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison lifetime*   MILlife* spartylife*,  re i(ccode)
gatt `ii' orig
xtlogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ,  re i(ccode)
gatt `ii' noth
xtlogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ///
 , fe
gatt `ii' fe
xtlogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison ///
 lag12growth_maddison lifetime*   MILlife* spartylife*,  re i(ccode)
gatt `ii' time
xtlogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ///
 lifetime*   MILlife* spartylife* , fe
gatt `ii' fet
qui clogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison  lag12growth_maddison , group(ccode)
logit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison ///
  i.ccode#c.year lag12growth_maddison /*lifetime*   MILlife* spartylife* */ if e(sample) & ccode~=817 & ccode~=347 & ccode~=640,  cl(ccode)
gatt `ii' ct
xtreg dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison i.year ///
 , fe vce(cl ccode)
gatt `ii' cyfe
clogit dem gattwto aidgl12  spartyaidgl12  MILaidgl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ///
 , group(year) vce(cl year) 
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1

*** MODEL 4
xtlogit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison lifetime*   MILlife* spartylife*,  re i(ccode)
gatt `ii' orig
xtlogit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ,  re i(ccode)
gatt `ii' noth
xtlogit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ///
 , fe
gatt `ii' fe
xtlogit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison ///
 lag12growth_maddison lifetime*   MILlife* spartylife*,  re i(ccode)
gatt `ii' time
xtlogit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ///
 lifetime*   MILlife* spartylife* , fe
gatt `ii' fet
logit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison ///
  i.ccode#c.year lag12growth_maddison /*lifetime*   MILlife* spartylife* */ ,  cl(ccode)
gatt `ii' ct
xtreg dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison i.year ///
 , fe vce(cl ccode)
gatt `ii' cyfe
clogit dem aidcl12 gattwto spartyaidcl12  MILaidcl12 sparty MIL   neighbor_mean2polity  conflict_intensity lgdp_maddison lag12growth_maddison ///
 , group(year) vce(cl year) 
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1

***********
**Table 4**
***********

***Polity ***
tsset ccode year
gen dpol3 = polity2-l.polity2>=3 if polity2~=. & l.polity2~=.
gen malay10= country=="Malaysia" & (polity==10 | l.polity==10)
gen sp = sparty==1 | sppers==1 | tthreat==1 if sparty~=.
gen spaidgl12 = sp*aidgl12
gen spaidcl12 = sp*aidcl12
gen splife = sp*lifetime
gen splife2 = sp*lifetime2
gen splife3 = sp*lifetime3
gen lpolity2 = l.polity2
/*
logit  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12     neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison d19* lifetime*   Wstar12life*  if malay10==0 , cluster(regtype)
gatt `ii'
local ii=`ii'+1*/
logit  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison d19* lifetime*   Wstar12life*  if malay10==0 , cluster(regtype)
gatt `ii' orig
logit  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison  if malay10==0 , cluster(regtype)
gatt `ii' noth
xtlogit  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	if malay10==0 , fe
gatt `ii' fe
logit  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison ///
	lag12growth_maddison d19* lifetime*   Wstar12life*  if malay10==0 , cluster(regtype)
gatt `ii' time
xtlogit  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	d19* lifetime*   Wstar12life*  if malay10==0 , fe
gatt `ii' fet
logit  dpol3 /*l.polity2*/ gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison ///
	i.ccode#c.year lag12growth_maddison /*d19* lifetime*   Wstar12life* */ if malay10==0 , cluster(regtype)
gatt `ii' ct
xtreg  dpol3 l.polity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison i.year ///
	if malay10==0 , fe vce(cl ccode)
gatt `ii' cyfe
clogit  dpol3 lpolity2 gattwto aidgl12 Wstar12 Wstar12aidgl12  growthaidgl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	if malay10==0 , group(year) vce(cl year)
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

/*logit  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12     neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison d19* lifetime*   Wstar12life*  if malay10==0 , cluster(regtype)
gatt `ii'
local ii=`ii'+1*/
logit  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison d19* lifetime*   Wstar12life*  if malay10==0 , cluster(regtype)
gatt `ii' orig
logit  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison   if malay10==0 , cluster(regtype)
gatt `ii' noth
xtlogit  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
  if malay10==0 , fe
gatt `ii' fe
logit  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison ///
	lag12growth_maddison d19* lifetime*   Wstar12life*  if malay10==0 , cluster(regtype)
gatt `ii' time
xtlogit  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	d19* lifetime*   Wstar12life*  if malay10==0 , fe
gatt `ii' fet
logit  dpol3 /*l.polity2*/ gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison ///
	i.ccode#c.year lag12growth_maddison /*d19* lifetime*   Wstar12life* */ if malay10==0 , cluster(regtype)
gatt `ii' ct
xtreg  dpol3 l.polity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison i.year ///
  if malay10==0 , fe vce(cl ccode)
gatt `ii' cyfe
clogit  dpol3 lpolity2 gattwto aidcl12 Wstar12 Wstar12aidcl12  growthaidcl12  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
  if malay10==0 , group(year) vce(cl year)
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines+decdum" if _n==`ii'
local ii=`ii'+1

/*logit  dpol3 l.polity2 aidgl12  gattwto   spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison d19* lifetime*     MILlife* splife* if malay10==0 , cluster(regtype)
 gatt `ii'
local ii=`ii'+1*/

logit  dpol3 l.polity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison   lifetime*     MILlife* splife* if malay10==0 ,  cluster(regtype)
gatt `ii' orig
logit  dpol3 l.polity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison    if malay10==0 ,  cluster(regtype)
gatt `ii' noth
xtlogit  dpol3 l.polity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	if malay10==0 ,  fe
gatt `ii' fe
logit  dpol3 l.polity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int ///
	lgdp_maddison lag12growth_maddison   lifetime*     MILlife* splife* if malay10==0 ,  cluster(regtype)
gatt `ii' time
xtlogit  dpol3 l.polity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	lifetime*     MILlife* splife* if malay10==0 ,  fe
gatt `ii' fet
logit  dpol3 /*l.polity2*/ aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int ///
	i.ccode#c.year lgdp_maddison lag12growth_maddison /*  lifetime*     MILlife* splife**/ if malay10==0 ,  cluster(regtype)
gatt `ii' ct
xtreg  dpol3 l.polity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	i.year if malay10==0 ,  fe vce(cl ccode)
gatt `ii' cyfe
clogit  dpol3 lpolity2 aidgl12  gattwto  growthaidgl12  spaidgl12  MILaidgl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
	if malay10==0 ,  group(year) vce(cl year)
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1

/*logit  dpol3 l.polity2 aidcl12  gattwto   spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison d19* lifetime*     MILlife* splife* if malay10==0 , cluster(regtype)
gatt `ii'
local ii=`ii'+1*/

logit  dpol3 l.polity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison   lifetime*     MILlife* splife* if malay10==0 , cluster(regtype)
gatt `ii' orig
logit  dpol3 l.polity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison    if malay10==0 , cluster(regtype)
gatt `ii' noth
xtlogit  dpol3 l.polity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
    if malay10==0 , fe
gatt `ii' fe
logit  dpol3 l.polity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int ///
	lgdp_maddison lag12growth_maddison   lifetime*     MILlife* splife* if malay10==0 , cluster(regtype)
gatt `ii' time
xtlogit  dpol3 l.polity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
    lifetime*     MILlife* splife* if malay10==0 , fe
gatt `ii' fet
logit  dpol3 /*l.polity2*/ aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int ///
	i.ccode#c.year lgdp_maddison lag12growth_maddison  /* lifetime*     MILlife* splife**/ if malay10==0 , cluster(regtype)
gatt `ii' ct
xtreg  dpol3 l.polity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
    i.year if malay10==0 , fe vce(cl ccode)
gatt `ii' cyfe
clogit  dpol3 lpolity2 aidcl12  gattwto  growthaidcl12  spaidcl12  MILaidcl12 sp  MIL  neighbor_mean2polity  conflict_int lgdp_maddison lag12growth_maddison ///
    if malay10==0 , group(year) vce(cl year)
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="splines" if _n==`ii'
local ii=`ii'+1
replace study = "Wright 2009" if studynum~=. 	

keep study-timetrend
drop if studynum==.
compress
save wright2009.dta , replace
